package main.java.indi.zyj.hot100;

import main.java.indi.zyj.hot100.base.ListNode;
import main.java.indi.zyj.hot100.base.TreeNode;

import java.util.ArrayList;
import java.util.List;
import java.util.function.IntToDoubleFunction;

public class _31_inorderTraversal {
    public List<Integer> inorderTraversal(TreeNode root) {

        List<Integer> list = new  ArrayList<>();
        inOrder(root, list);
        return list;

    }

    public void inOrder(TreeNode node, List<Integer> res){
        if (node == null){
            return;
        }
        inOrder(node.left, res);
        res.add(node.val);
        inOrder(node.right, res);
    }
}
